/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package TableHelpers;

import SQLAPI.Employee;
import SQLAPI.SQL;
import java.util.ArrayList;

/**
 *
 * @author anvil
 */
public class EmployeeTable {
    
    private SQL sql = new SQL();

    public EmployeeTable() {
    }
    
    public String createTable()
    {
        String table="<thead>";
        ArrayList<Employee> list = sql.getWebUsers();
        table+="<tr><th>Employee ID</th>";
        table+="<th>First Name</th>";
        table+="<th>Last Name</th>";
        table+="<th>Email</th>";
        table+="<th>Work Phone #</th>";
        table+="<th>Mobile Phone #</th></tr></thead>";
        table+="<tbody>";
        
        for(int i=0;i<list.size();i++)
        {
            Employee e=list.get(i);
            table+="<td>"+e.getEmpid()+"</td>";
            table+="<td>"+e.getFname()+"</td>";
            table+="<td>"+e.getLname()+"</td>";
            table+="<td>"+e.getEmail()+"</td>";
            table+="<td>"+e.getWphone()+"</td>";
            table+="<td>"+e.getMphone()+"</td>";
        }
        table+="</tbody>";
        
        return table;
    }
    
}
